home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-01-31 | 2.6 KB | 77 lines | [TEXT/ToyS] |
- property idleTime : 900 --set for 15 minutes; set to your own preference
- property theFlag : false
- property theList : {}
-
- on writer()
- set thePath to path to me as string
- set newPath to (replace "Easy-View reply" in thePath with "addresses") as string
- set fnameA to alias newPath
- set theFlag to false --keeps the Idle dialog from running 1st time this app runs
- set msgBod to ""
- set theEndA to (get eof fnameA)
- set theWordsA to (read fnameA from 1 to theEndA)
- set theList to tokenize the theWordsA with delimiters return
- try
- tell application "Eudora1.5.1"
- activate
- copy (the clipboard) to origMsg
- make new message at end of mailbox "out"
- set body of message 0 to origMsg
- --set field "To:" of message 0 to "macscrpt@dartcms1.dartmouth.edu"
- set newBod to (tokenize origMsg with delimiters return & return)
- repeat with i from 1 to (count of paragraph of (item 1 of newBod))
- set flagA to false
- set flagB to false
- if (paragraph i of item 1 of newBod) contains "Subject:" then
- set newSubj to (tokenize (paragraph i of item 1 of newBod) with delimiters "ct: ")
- set field "Subject:" of message 0 to (item 2 of newSubj)
- set flagA to true
- end if
- if (paragraph i of item 1 of newBod) contains "From:" then
- set newSubj to (tokenize (paragraph i of item 1 of newBod) with delimiters "om: ")
- --set field "To:" of message 0 to (item 2 of newSubj)
- set listItem to {item 2 of newSubj}
- set newList to theList & listItem
- (choose from list newList prompt "Which address are you mailing to?" ok button ¬
- "OK" cancel button "Cancel" with empty lists)
- set field "To:" of message 0 to the result as string
- set theList to {}
- set flagB to true
- end if
- if (flagA and flagB) then
- exit repeat
- end if
-
- end repeat
- repeat with i from 2 to (count of newBod) -- the loop re-formats the msg w/paragraphs
- set newBod1 to ((item i) of newBod) as text
- set msgBod to (msgBod & return & return & newBod1)
- end repeat
- set body of message 0 to msgBod
- set theFlag to true
- end tell
- on error errMsg number errNum
- activate --brings to the front for an error msg
- display dialog errMsg & return & errNum
- end try
- end writer
-
- on quit
- continue quit
- end quit
-
- on idle
- if theFlag then
- tell me
- activate --brings to the front for the dialog
- display dialog ¬
- "Application Easy-View reply is open. Do you want to quit or leave it open?" buttons {"Quit", "Keep it running."} default button {"Keep it running."}
- if button returned of (the result) is "Quit" then
- quit
- end if
- end tell
- else
- return idleTime
- end if
- return idleTime
- end idle